{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fe04cb3b",
   "metadata": {},
   "outputs": [],
   "source": [
    "API_KEY = 'rKCwFV4vuWMfn2t9wgotn1LU'\n",
    "SECRET_KEY = '5ooS6Rxnl4uHAAFQwysjriI2Ebmq13IZ'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ce47d667",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1be2c3d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import json\n",
    "TL_key = '44f662cceda24605891834e31862e9f8'\n",
    "TL_url = \"http://openapi.turingapi.com/openapi/api/v2\"\n",
    "\n",
    "payload={\n",
    "    \"reqType\":0,\n",
    "    \"perception\": {\n",
    "        \"inputText\": {\n",
    "            \"text\": \"雪梨英语怎么说\"\n",
    "        },\n",
    "    },\n",
    "    \"userInfo\": {\n",
    "        \"apiKey\": TL_key,\n",
    "        \"userId\": \"1234\"\n",
    "    }\n",
    "}\n",
    "\n",
    "res = requests.post(TL_url,data=json.dumps(payload))\n",
    "res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "fa9dfca7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'intent': {'code': 4003},\n",
       " 'results': [{'groupType': 0,\n",
       "   'resultType': 'text',\n",
       "   'values': {'text': '请求次数超限制!'}}]}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "da9f3d05",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
